﻿using STHPMS1.ICore.I_Entity;
using STHPMS1.ICore.I_Entity.Info;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace STHPMS1.Common.C_Entity
{
    public class PagingInfo : IPagingInfo
    {
        public int PageIndex { get; set; }
        public int PageSize { get; set; }
        public int TotalRecords { get; set; }

        public int CalcPageCount()
        {
            if (this.PageSize == 0 || this.TotalRecords == 0)
            {
                return 0;
            }
            return (int)Math.Ceiling((double)this.TotalRecords / (double)this.PageSize);
        }
    }

    public class DefPageInfo : PagingInfo
    {
        public DefPageInfo()
        {
            PageIndex = 0;
            PageSize = int.MaxValue;
        }
    }
}